package com.majie.utils.utils.sign;

import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;

/**
 * 验签aop
 */
@Component
@Aspect
public class SignAop {


    @Before(value = "execution(* com.majie.controller.*.*(..)) && args(authId,sign,text,..)", argNames = "authId,sign,text")
    public void verify(String authId, String sign, SignText text) {
        String publicKey = "xxxxxxxxxxx";
        Assert.isTrue(RSAUtil.verify(text.toText(), sign, publicKey), "验签失败");
    }
}
